﻿using MiniErp.Entity.DataStreams.DOs.AssetManagement;
using MiniErp.Entity.DataStreams.DOs.Notice;
using MiniErp.Entity.DataStreams.DOs.WeeklyReport;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniErp.Entity.DataStreams.DOs
{
    /// <summary>
    /// 用户信息实体
    /// </summary>
    [Table("UserInfo")]
    public class UserInfo : BaseEntity
    {
        /// <summary>
        /// 工号
        /// </summary>
        [Key]
        [MaxLength(6, ErrorMessage = "工号必须为6位数"), MinLength(6, ErrorMessage = "工号必须为6位数")]
        [ConcurrencyCheck]
        public int UId { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        [MaxLength(12, ErrorMessage = "密码必须小于12个字符"), MinLength(6, ErrorMessage = "密码必须大于6个字符")]
        [Required]
        public string PassWord { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        /// 
        [MaxLength(6, ErrorMessage = "用户名必须小于6个字符"), MinLength(2, ErrorMessage = "用户名必须大于2个字符")]
        [Required]
        public string UserName { get; set; }
        /// <summary>
        /// 状态（在职，离职）
        /// </summary>
        [Required]
        public bool State { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        [Column(TypeName = "bigint(11)")]
        public long PhoneNumber { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        public string MailBox { get; set; }

        #region 导航属性
        /// <summary>
        /// 岗位ID
        /// </summary>
        public int JobsId { get; set; }
        public virtual Jobs Jobs { get; set; }


        /// <summary>
        /// 职称编号
        /// </summary>
        public int TitlesId { get; set; }
        public virtual Titles Titles { get; set; }


        public virtual List<AssetInfo> AssetInfos { get; set; }
        public virtual List<Notices> Notices { get; set; }
        public virtual List<UserInfoNoticesReply> UserInfoNoticesReplies { get; set; }
        public virtual List<WeeklyInfo> WeeklyInfos { get; set; }
        #endregion
    }
}
